package com.example.xxpk.controller.login;

import com.example.xxpk.common.result.R;
import com.example.xxpk.pojo.Users;
import com.example.xxpk.service.users.IUsersService;
import com.example.xxpk.vo.LoginVo;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/users")
@RequiredArgsConstructor
@Api(tags="登录表")
public class LoginController {

    private final IUsersService usersService;
    // 会话登录接口
    @PostMapping("doLogin")
    public R login(@RequestBody LoginVo loginVo) {
        Users users = usersService.login(loginVo);
        // 第一步：比对前端提交的账号名称、密码
        return R.data(users);
    }



}
